home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / pine / osdep / domnames.dos < prev    next >
Text File  |  1994-06-27  |  2KB  |  46 lines

  1. #line 2 "osdep/domnames.dos"
  2.  
  3. /*----------------------------------------------------------------------
  4.        Get the current host and domain names
  5.  
  6.     Args: hostname   -- buffer to return the hostname in
  7.           hsize      -- size of buffer above
  8.           domainname -- buffer to return domain name in
  9.           dsize      -- size of buffer above
  10.  
  11.   Result: The system host and domain names are returned. If the full host
  12.           name is akbar.cac.washington.edu then the domainname is
  13.           cac.washington.edu.
  14.  
  15. On Internet connected hosts this look up uses /etc/hosts and DNS to
  16. figure all this out. On other less well connected machines some other
  17. file may be read. If there is no notion of a domain name the domain
  18. name may be left blank. On a PC where there really isn't a host name
  19. this should return blank strings. The .pinerc will take care of
  20. configuring the domain names. That is, this should only return the
  21. native system's idea of what the names are if the system has such
  22. a concept.
  23.  ----*/
  24. void
  25. getdomainnames(hostname, hsize, domainname, dsize)
  26.      char *hostname, *domainname;
  27.      int   hsize, dsize;
  28. {
  29.     char *p;
  30.  
  31.     hostname[0] = domainname[0] = '\0';
  32.     if(p = mylocalhost())
  33.       sprintf(hostname, "%.*s", hsize - 1, p);
  34.  
  35. #if    !defined(LWP) && !defined(_WINDOWS)
  36.     if(getdomainname(domainname, dsize-1) > 0)
  37.       return;
  38. #endif
  39.  
  40.     sprintf(domainname, "%.*s", dsize-1, 
  41.         (hostname[0] && hostname[0] != '[' && (p = strindex(hostname,'.')))
  42.           ? p+1 : hostname);
  43. }
  44.  
  45.  
  46.